<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>找回密码</title>
    <link rel="stylesheet" href="css/main.css" />
    <link rel="stylesheet" href="css/findpass.css" />
    <link rel="stylesheet" href="iconfont/iconfont.css" />
</head>
<body>
    <!--header开始-->
      <header>
            <div class="iconfont icon-fanhui mui-action-back" style="font-size:0.34rem"></div>
        	<div style="font-size:0.34rem;color:#fff;">找回密码</div>
      </header>
    <!--header结束-->
	<!--验证开始-->
	    <form action="" class="form">
	    	 <!--手机号-->
	        <div  class="username">
	    		<div>
	    		<img src="img/icon_phone@2x.png" alt=""  style="width:0.36rem;height:0.36rem;margin-right:0.35rem;"/>
	    		<input type="text" name="userphone" placeholder="请输入手机号" id="findmobile" />
	    		</div>
	    	</div>
	    	<!--验证码-->
	        <div  class="username" style="position:relative;">
	    		<div>
	    		<img src="img/icon_yz@2x.png" alt=""  style="width:0.36rem;height:0.36rem;margin-right:0.35rem;"/>
	    		<input type="text" name="phonecode" placeholder="验证码"  id="findcode"/>
	    		<span class="phonecode">获取验证码</span>
	    		</div>
	    	</div>
	    		<!--创建帐号-->
    	    <div class="next">下一步</div>
	    </form>
	<!--验证结束-->

</body>
<script src="js/pxtorem.js"></script>
<script src="js/mui.js"></script>
<script src="js/apptool.js"></script>
<script src="js/httptool.js"></script>
<script src="js/loginCenter.js"></script>
<script>
	mui.init();
	mui.plusReady(function(){
		//返回键功能
		webtool.newback();
				//获取验证码
	var codeInfo = {};	
	mui('.phonecode')[0].addEventListener('tap',function(){
		var findmobileValue=mui('#findmobile')[0].value;
		if(apptools.checkMobile(findmobileValue)) {
			var waiting = apptools.showNativeWaiting();
			codeInfo.mobile = findmobileValue;
			ucenter.getLoginVerify(codeInfo, function(res) {
				var loginWeb = plus.webview.currentWebview();
				if(res.code == 200) {
					waiting.close();
					verifyCount(mui('.phonecode')[0], 30);
					mui.toast('短信发送成功...');
				} else {
					waiting.close();
					mui.toast(res.desc);
				}
			})
		}
	})
	mui('.next')[0].addEventListener('tap',function(e){
		var findmobile=mui('#findmobile')[0].value;
		var findcode=mui('#findcode')[0].value;
		if(apptools.checkMobile(findmobile)){
			if(!findcode){
				mui.toast('验证码信息不能为空');
			}else{
				mui.ajax('http://moyu.youledi.cn/moyu/Api/Login/getPwd',{
					data:{
						mobile:findmobile,
						code:findcode,
					},
					dataType:'json',
					type:'post',
					headers:{'Content-Type':'application/json'},
					success:function(data){
						data=JSON.stringify(data);
						console.log(data);
						if(data.code==200){
							plus.webview.currentWebview().close();
							webtool.openPreView('resetpass',function(wb){
								wb.show('slide-in-right',300);
							})
						}else{
							mui.toast(data.message);
						}
					},
					error:function(xhr,type,errorThrown){
						//异常处理；
						console.log(xhr)
					}
				})
			}
		}
	})
	})
</script>
</html>